#pragma once

template<typename T>
struct CRefCountedObject : CComObjectRootEx<CComSingleThreadModel>,
                           IUnknown
{
	DECLARE_NO_REGISTRY()
	DECLARE_NOT_AGGREGATABLE(T)

	BEGIN_COM_MAP(T)
		COM_INTERFACE_ENTRY(IUnknown)
	END_COM_MAP()

protected:
	
	CRefCountedObject()
	{
	}

private:

	// noncopyable
	CRefCountedObject(const CRefCountedObject &);
	CRefCountedObject & operator=(const CRefCountedObject &);
};